﻿using System;
using System.Reflection;
using System.Runtime.Serialization;

namespace Cubicle.Core.DataContracts
{
    [DataContract]
    [Serializable]
    public class MemberData
    {
        public MemberData(int id, MemberInfo mi)
        {
            Id = id;
            MemberType = mi.MemberType.ToString();
            Name = mi.Name;
            ReturnType = mi is MethodInfo 
                             ? (mi as MethodInfo).ReturnType.FullName 
                             : null;
        }

        [DataMember]
        public int Id { get; set; }

        [DataMember]
        public string MemberType { get; set; }

        [DataMember]
        public string Name { get; set; }

        [DataMember]
        public string ReturnType { get; set; }

    }
}